#include "stm32f10x.h"                  // Device header

void Timer_Init(void)
{
	/*定义时基单元配置结构体*/
	TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct = {0};
	
	
	/*开启TIM2时钟*/
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
	
	/*选择内部时钟*/
	TIM_InternalClockConfig(TIM2);
	
	/*配置时基单元,初始化配置*/
	TIM_TimeBaseInitStruct.TIM_ClockDivision = TIM_CKD_DIV1;						//分频选择，1分频
	TIM_TimeBaseInitStruct.TIM_CounterMode = TIM_CounterMode_Up;					//计数器模式，向上计数
	TIM_TimeBaseInitStruct.TIM_Period = 10000-1;
	TIM_TimeBaseInitStruct.TIM_Prescaler = 7200-1;
	TIM_TimeBaseInitStruct.TIM_RepetitionCounter = 0;							
	TIM_TimeBaseInit(TIM2, &TIM_TimeBaseInitStruct);
	
	/*使能定时器中断，更新中断*/
	TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);
	
	
	
}